Added: handling zero length message and no database