Fix condition in handling data message
Remove unused method.