Fixed checking for illegal registers