fix for #802 - log and return error when script is incomplete

#802