Fixing bugs in previous commit