Fixed bugs in helper class

Fixed bugs in helper class