Some orm fixes