Fixing minnor bugs