Fix bugs of previous commit