Fixed errorchecking.