fixed bugs in swift playground code