Fix Commit() so that it always updates the HEAD

Fix #692