Fix calculating resources