fixed some encoding problems, added debug mode that avoids constant remote requesting