Fixed bug in calcParams