fixed bugs and improvements