Is that the first time you have shot a .40 S&W ? The recoil is a tad "snappy" as oppossed to the steel frame 1911 and the "push" of the .45 ACP. From your low left shot placement you may be anticipating the recoil and jerking down and left if you are right handed. Just a thought.
The Glock has a larger grip being a double stacked mag and depending on your hand size you may be gripping around the stock to the right and not having the axis of the bore lined up with your forearm. Again just a thought.