trying to calculate quantity but it breakes