Fixed #453 and added test cases

I gave a shot at #453 and tried to add two test cases to make sure it works. I realized my fix may result in a crash if `condition` is a float value. Is it safe to assume the argument will always be an integer or string? 

I'm fairly new at this, so any feedback is more than welcome ^^