Fixed potential segfault on incorrect arguments