Fixed nullpointer (added opposite manually). Check for validity