fixed undefined issue