Write assembly to temporary file then copy over.

Helps with debugging when input == output. Assembly isn't corrupted if
write fails.
Fixed method finding.