fixed some errors from manual testing
fixed an issue and minor cleanup