fix two bugs of previous commit