Firebird Tests

Modify current tests to run with firebird database and fix some bugs to make it passes all.