Fix some refactor issues