Changed error handling for clearText