check stack before adding statements, closes #1