Fix some problems in startup scripts