Fixed issue #101, which affected image layers and masks