fix this is undefined bug