When buying ship gadgets/upgrades, if you "queue" up modules to be sold without confirming the sale (by checking out), the number of equipped modules goes down. This allows you to go back into the buy tab and buy more upgrades. After this, you can return to the sell tab and "unqueue" your previous modules to be sold and finalize checking out, putting you above the module limit for your ship.