Fix dump network

Some errors that were breaking things.

The backward pass still does not work (wrong Caffe::phase()), will look at it tomorrow.