Add test and fix quotaRemaining issue, (hopefully) fixes #36