fix and refactoring getClassName() method