refator and fix path bug