make sure variables are set in case of error