fixed some bug and code improvement