Fixed Debug function