I try to not use sleep whenever possible because it is very unreliable. Can you try optimize() instead?