Fixes bug that causes init scripts to fail silently

See #5218