Fixed run-main problems