Fixed appt null reference bug