Fix bugs in postinst scripts