take function out of if statement to

see if that throwing error