bug when using multiple layers