improved postrm and prerm for app package