some error detections added