Fixed linux and mac bugs