Fix application errors with PostgreSQL
Rewrite tests with Codeception 2.0