Changed calculation of pixel loss. It's better, but still not correct always.