ENH: improved logm and tests