Fixed problems regarding debug mode.