Fixed several bugs related to function returns:
  1. Now returns a copy not a view
  2. Class copies were broken
  3. Vector copies were broken

Added unit test for set