Fixed issue with getLayerId function