Added error checking in block listener.