fixed error handling in ? operation