fix bug in network.coffee flatten; instance should override last but cant if it is also first