Fix race condition causing some apps to be rendered more than once