dereference: fix handling DEREFERENCE from the database