add tests and fix https://github.com/wyuenho/backgrid/issues/323