Fixed several small bugs that came up when using it.