So much ugly branching to fix #58