Fixed issues in amount calculation