Implemented error handling for title setting