fixed several minor errors, fixed Makefiles, and made sample for bug