#5 fix the undefined issue