prevent 0 division, fix #11