fixes bugs in fitTextInTextField and cutTextToFitInTextField