fixed bugs in detecting design errors