Fixed bugs in main and actions