fixed bugs in controllers