updated prediction alg and minor bugfixes