Fixed several issues in controllers