removed many bugs