Added fallback for current resource, future proofing against require and fixing entities target property