Added index to profiles table.

Fixes #518