fix filepath might never reach the root path