Fixed bug in listing and added better debug output.