Fixed warnings and issues on OS X