Fix handler and add missing tests (re #91)