fix encoding and null result