Fixed passing by value error in sm