Branch stockfix: minor sql fix

If the branch is used to make an installation could cause problems.