debug option added

other minor improvements