null memory clean fixes