changed the calculator to produce an integer
support PostgreSQL