fixed error handling in mapreduce query