Fixed nasty data copy bug