fixed issue with scripts and queries