Added some fixes for payload calculation