Fixed null handling. Improved syntax for EHR SYSTEM. Fixed performance in CreateReport