fix bugs and add unique constraint to StarredFiles table