various error checks