Added some debugging and fixed a type-o.