fix potential bugs