Fix a couple of bugs that happen w/ empty db