Variety of bugs introduced in refactoring fixed