update to master and fix bugs