Avoiding 'pc is undefined' failures

Fixes #3405, #3344, #2933, #2066 

Affects #2763, #1171 and #2799