the way I understand your statement, it sounds like you are downshifting from 40mph into 2nd, and soon after into 1st, and then apply the break to slow down.
40mph is WAY to fast be downshifting into 2nd, let alone first. if you are in 3rd doing 40mph, approaching a light, apply your brakes till you have slowed to about 20mph, with the bike still in 3rd gear. at about 20 put it into second. you can then either leave it in 2nd till you are at a complete stop, put it in neutral, wait for the light and the put it in first to go (this is what I usually do) or you can change in 1st when you are still rolling, but are almost stopped. I try not to shift into 1st at speeds over 10.