fix issue with changing directory which cause fatal error