fix function argument passing and return