fixed some  bugs