Reverting #4309 at this caused TypeError: object is not a function