fixing helper function