fix a potential crash

don't know why it happens