Give runtime type error when while condition wrong