fixed type cast when dealing with booleans