added count check for output #266