fixed handling of layers parameter when loading