Bug fix with argument error check