Bug fix: wrong state in programs