Fixed OSX issues (#1847)