Fix bug in if-condition with and usage. Added test.