Fixed bad comparison between BOOL and nil