Avoid invalid expression and type mismatch

Invalid expression error is produced when trying to open certain tags