updated and fixed bugs