fix for issue #1144

please add some comments explaining this hook