ld9040: add additional checks and fixes

Change-Id: I9823f0e52735577e78b8a6c762666ccf110ecdad