Some changes to improve API debuggin and old API support