don't overwrite variable reference when iterating

Also popuplate full backtrace when rescuing from a generic exception
to aid in debugging.