fix for speed problems introduces in previous versions