oops, one fragment had been oversimplified when porting to python3