fixed compiling issue, tiny bit of refactoring