Made the use of scripts more robust

Signed-off-by: Thomas Hodgson <thomas.hodgson@gmail.com>