fixed bug with resetting variable which may already be set