Fermion localization on degenerate and critical branes