Make init script more robust