Automatically download the db if required, fix bug, add test