fixed delete and calculate method