small bug fix on function call