fixes bug of invoking function with proper argument