Fixed bug with size checking in c++ realization