Fix weird "cannot compare values of different types" error