Fix core to return invalidargument exception on bad input data