added more asserting to track down bug