change dir before getpid