Order related stuff

and added a bit of robustness to serializedb