some more candidate fixes.. did some bad hacking there, but it does the job until I fix the whole thing up