bug fixes, better metadata output