Fix bugs with resources