Fix readonly variable bug