Bug fix: many bugs