Sounds like something is either not assembled right, or is bent.
First thing I'd check is to make sure the metal insert in the stock that forms the magwell (the one held in place by the screw on each side of the stock) is in there correctly, and is tight. The forward stock liner goes underneath the tab on the front of that.
Second, fit the trigger assembly to the receiver without the stock and make sure the catches on the front of the trigger assembly line up with the recesses in the receiver. If something is bent, that would explain both your problems.
Finally, I'd check to make sure the bolt carrier/gas piston, bolt, etc. are assembled in there correctly.
BTW, when you shoot it and the trigger assembly falls out, is the guard popping open, or is it falling out with the guard still closed?