fixed bug in id-parsing
replaced c-style casts with static_casts
improved debug-mode