Fixed emit wrapping function to actually return the value