potential bug fixes for imperfect data input