improved data handling, fixed SVD