fixed bugs in previous commit