added some automatic type casts, fixed bug concerning ID redefinition