safe bool casting