added exception for when resources returns null