fixed errors

function ddply