fix duplicate name collisions and remove references to non existent columns
fixes #9