fix some remaining bugs