investigating stackoverflow error