Bugs fixed

Some bugs fixed