Fixed missing controller condition
Improved error logging