Fix end-of-defun bug on single line fns; add tests