Made `sprint_object()` much more sensible and fixed a memory leak.