Fixed a bug which raised an error when calling removeLayerGroup()