bug fixes and debugging info