fixed issues with wrong array sizes