Fix several issues with course deletion

This patch fixes three issues with course deletion, two new and one
longstanding.

Change-Id: I6a88a86097afbc55c4258dc2d73d273fd9fbcf3c