make it compatiable to sbcl
refactor code, remove some unbound var.
refactor tests