Issue 626 by Pjohans: better solution - prevent inserts of zero values by using transaction