fix bug null/undefined bug