check argument sizes to prevent segfaults