Fixes bug 910350 Add function to fix permissions on tables