Closes #15: fix off by one error when writing percentage to database