Bugfix: prevent null pointer exception