Don't try to delete dir if it doesn't exist
Fix branch detection