fix fundamental issues in datasrc and memory issue