Fix couple minor issues, add test