Fix a bug in -lookup.

Prevent lookup for returning a pixel when the coordinates are out of
bounds.