for performance, encode remove return value check