Cleaned up fix for #40