Fix Boolean typecasting

I've noticed that typecasting is not working for Boolean. This is proposed fix (it's working for us).