remove trailing whitespaces in 2d library