updated layer destroy function