fixed the rendering to only render layers which should be shown