Fixed problem with models causing database crash.
Added seed and key byte generation.