work around a firefox bug when calculation search width. fixes #944