Fix for 'cannot read length' bug on server