Fix helper function