improve error detection
docs