Use current activerecord if available
Fix postgres type errors