mod_base: cherry pick from 5d252cb. Issue #491