Two possibilities:
- TinyDB is shared among different apps when using the Companion, not when running a compiled app. An improper TinyDB default could be at fault.
- Screen switching is different between the Companion and a compiled app.
If that doesn't help, post an .aia