Fixed additional memory allocation issues, added stats