added debug wrapping