check args and croak

1. check arguments
2. add test cases