main added, bugfixes