Fix controller logic