Make install functions a bit more robust