add a safe_asprintf
make elephant printing more efficient