fixed course concurrency issue
fixed sql script generator (not important)