move doneExecutingCode to the VERY END of callback
for hopefully better reliability