make accept use the right fd; add error checks and improve logging to assist when things go wrong.