Avoid null pointer exception, thanks to Vjeko