add test and check division for 0
fix buf