slightly improve C memory handling. Still nasty.