made script slightly safer to use