Some clean up
Minor bugfixes