Add safe_bool
Use safe_bool in shared_handler