Fix #37 by improving constructor handling