fixed bug in function call