bug fix #399662 by emackn: some code was accidently deleted between beta2 and beta3, also hadto fix that and rework some of the cacheing calls.