Modify define find head function. Thanks to Roi and Felix for your time to try this script.