Fixes #78 by making sure all cases are correctly handled