Various bugfixes. Removed genname dependency.