Validation improved and fixed exception.