Build fixes for mac and linux