IsOrigin now works fine, also improved perfomance

fixed IsOrigin param
also now the maxConnectionTime is included in generating the query, which will probably makes it faster since most of time maxConnectionTime is less then one day, and previously it was hard coded to a day. This also means now maxConnectionTime can be set to any value