Fixes #6141 - Removes usages of extract() function

Additionally I've moved sanitization code below the trigger that might return not sanitized data.