Fix function call and adjust offset