fix extending of $
add tests