Minor tweaks in error handling and connect.