Fixed "Switched xxx from undefined to zzz" bug