Debug function for R