Added check for existing inventur

and also minor bugfixes
forgot to remove debug info