constructor compatible with be calling as ordinary function