fixing initialization of layer model in various places