Fixing some bugs

bug numbre 3 and 4