replaced :(first|last)-child selector (not working correctly)