update key, fix bugs, make it working