orrected error in computing a and b

- yet another casting error :)
- now works very very well :)