Implementation of LayerGroup.getLayer with really bad performance. fixes #244