that .on('error' stuff is definitely a source of problems