fix bug in accessing some attributes of Course and various improvements (esp. in Devise)