Before clicking on a control, it is best practice to use a WaitForCreate() on the control (instead of sleeps) to ensure that it is created before trying to click on it. It is usually more reliable and consistent than a sleep. Please try this to see if it resolves this issue.
What is the sleep value that you are using on the sleep method? You may need to extend the number of milliseconds to account for a slow screen times. The button may not be available for interaction at the time the perform click is occurring.