fix mac stuff, new functions