Fixed filtering in value form dependencies

Signed-off-by: Tom Wright <tom@inflatablecookie.com>
Updated sql exceptions

Signed-off-by: Tom Wright <tom@inflatablecookie.com>