fixed a bug in helper functions