fixed wrap around bug