fixed issue with returning null resource