fixed elif/elseif issue that excluded HAVE_COCOA on OSX
replaced isnan for cvIsNan