Fix votes and add some tests for DB