More robust startup script