fixed refactoring bug in singleton method