Add check for the validity of return data