BBs falling out is completely normal. When you insert your mag into your gun, your hopup holds the mag's spring-latch open and BBs are forced into the hopup by the mag's spring. The only thing preventing them from going into the chamber is the nozzle in the way, which only gets moved out of the way when you fire.
Meanwhile, you have those BBs that are being held in the hopup chamber by nothing but the mag.. When you take the mag out, there's nothing holding those BBs in there. They fall out. Perfectly normal.
Note that it is possible to design a hopup that prevents this from happening. An example of a hopup that prevents BBs from falling out is the Madbull Ultimate Hopup, which has a small o-ring at the bottom of the hopup tube which by way of a window into the tube manages to stretch into it and gently hold BBs in the chamber. It's a pretty neat design.
Another way to prevent BBs from coming out is to have a decently-high RoF gun and a peppy mag spring. If you fire fast enough on full auto and the spring in your mag is strong enough, you will end up with no BBs left in your mag and no BBs left in your hopup. They'll have all been fired out.
Semi-auto stopping at times and requiring a burst is a common issue in AEGs, but I'll defer to the gun doctors here on that one...
Now you know