Fix database to use long integer as a date instead of single fields +
fix bug on empty entry list