bugfix for osx init script
adding cd check for osx init script