allocating correctly