fixed a bug that resetted the user level when setting the subscription status in a course instance
added a couple of database disconnection and fixed indentation
Merge branch 'master' into holis_test-2