fix serveal bugs