fixed function assignment bug