fixed MANY bugs