fix issue 19: preventOverflow bug