Cast to boolean - fixes and added test on it