Removing pass by reference in share controller and fixing variable in EpiApi. Closes #1175