Properly handle numpy arrays