fixed & completed get_pixels function