bug fix and fit to dot matrix