fix bugs from previous commit