add debug log before returning 0