Fixed error reporting bugs.