fix when tex == null
removed debug