found bug, minor changes to transfer function