Fixed script declaration position
Fixed query error visualization