fxing some bugs