Fix bug in getPrototype function