bug solved by adding syncthreads after shared memory was allocated