Improve robustness of post-install script