error detection added