first and last nodes correct; middle not working right