Add upgrade command, fix stores remaining locked after an error