returning first instead of the last error