make before hook promise compliant