Fix bugs on testing