Fixed small bugs in debug mode