Fixing of some bugs