Fixed waitFor() so that the error message is not displayed on success

Fixed waitFor() so that the error message is not displayed on successful call (#5)