error in log timestamp format
subtle order bug (thx xibeijan); bet bug; purge function