Added some control in getDays and add db.open