Check variables are valid
Fix paths if needed