added debug mode, fixed account processing