solved nullptr error