bug fix: make data pointer only when needed