Fixed wrong argument order, added tests to prevent in future.

Fixed wrong argument order, added tests to prevent in future.