Fix a bug in the cast operator to bool, and adding test cases covering the hole in tests