minor bug fixes

TODO: compiling and testing all files