Add light error detection and hadling.