bug fixes for defun