better handling of scripts