fix bug: restrict types and avoid null pointer
add join()
test error and join
delete main