bugs and fixes

bugs and fixes