Added tests for server actions and fixed issues found during testing