Fix incorrect message of TypeError
Master key API
Test coverage