Added unit test, small improvement in empty schema detection.