Fixing "Only Variables can be passed by reference error"