Why is my calculation not working