Fixes #928 for sure. also improved debug possibilities.