Fixed some bugs when creating/editing course database records