Fixed bug in entity collisions. New img functions added.