fixed uncertainty when using cos-function and small bugfixes