[nits] fix some recently introduced bugs and some long standing ones