fixed problem where empty words would be inserted into the database