minor fix
fix a bug of loading scripts in certain cases