Fixes bugs, where validation overwrote variables out of its scope