Fixing error when trying to use with no layer.