Moved assertions before variable is used