This is expected behavior because of eventual consistency.
Actually, because you are running the development server, this is only a simulation of eventual consistency - in the real production system, the results won't be quite as predictable. The solution is the same though.