Fixed the loop for the error message.