fixed bugs and improved setup