increase sleep from 500ms to 1000ms. still not sure what the problem is