changed if in imvvmViewModel to prevent checking twice unnecessarily