optimized weight update a bit, need to verify (again)