Fixing lotsa bugs