Fixed some bugs, improved error reporting. As in, added some.