fixed the bug and reverted previous commit