Fixed OSX-related runtime errors that were making the application crash