Fixed errors and support OSX