testing functions for correctness