cast kets to density matrices
bugfix