Fixes for mac compatibility