Some cleanup&&bug fix