Fixed race condition in solution.js