Fixed a circular table dependency.
Fixed a function call that was wrong.
Fixed a DB field name