Fix from ljunkie to skip invalid keys