hook function should not be called twice