fixes for compatiility with mac and linux