On the formation of protostellar disks