fix beforeStart hack not working sometimes