fixed a segfault in main execute loop