Fix setter function

Was pretty broken before