Fixed a bug in layer introduced by recent changes.