fix bug in map function - array internal pointer was not reset