Fix wrong function clause order