Add generic unlock detection, fix errors