added instanceof as a tempory solution