fix 8171 great help from @mdavis1982