applying Dave Pacheco's patch