Fixed error handling when valid.