fix View.delegate and undelegate bugs.