added support to detect deletion