Fixes null pointer exception and improves behavior of src() of when to trigger ready event