Added Log4r logging and fixed small bug.