Fix fancy indexing that was broken when using e.g. np.float32 

The bug was caused by the fact that isinstance(np.float32(3), float) is False.

Tests added.