Fixed a bug allowing user to add the same layer twice.