Fixed bug with not returning values in helper functions