added total statistics
fixed merge