fix issues revealed under OSX