Fix end of function error