fixed a couple more bugs and merge issues