Handle prototype assignments much better. Fixes issue #1023.

R=blickly