fixed typo/refactoring issues