Fixing some more bugs