fix undefined error on function params