fixed argument check and logging code