fixed some small refactor bugs