Fixed linux/osx bug
Fixed some minor bugs