Adding verification that upon layer reattaching, the second argument is in fact a layer.