fixes some bug.