Fixed what looked like segfault in calibration routines.
Fixed few compiler warnings.
Merge pull request #25 from raivisr/master

Fixed what looked like segfault in calibration routines.