Fixing many bugs