Added basic error handling for no-text situations.