Bug fixes in put_text_in_db