fixed server crash when accessing scheduled tasks via API; minor refactoring