Fixed an error handling bug

no data / wrong data error is treated correctly