fix int casting in function custom