Prevent double insert database error. Fixes #49.