fixed bugs from previous commit