Fix an issue with layers (issue #47).