Add checking of undefined to all controllers