Fixing bug in assignment code