Detects proper working directory