Small fixes, closes several small bugs