This is working as expected. There was mistake in my code logic itself :p