bug fix mysql exception and safe get env HOME