adds Mac Os X stuff
fixed a few bugs