functional updates

fixed some bugs
functional updates

bug fixes