fixed a couple things, add a test