merge from luca76 for layer context menu