Added sleep() to fix timing issue.