Oops wrong variable provided to function