modify main() to avoid ctrl quit