Bug fix: check for uncomitted changes first