Finally sorted out the bug: CANNOT ADD NULL to NOT NULL