refactor (fix bugs)