fixed a bug in calc