Adding some checks to eliminate unnecessary callbacks