One more speedup and a bug fix