functionality corrections and bug fixes