Fix a bug in handle_loop(); Slightly nicer layout.